import request from '@/utils/request'

// 查询用户用电记录列表
export function listRecord(query) {
  return request({
    url: '/business/record/list',
    method: 'get',
    params: query
  })
}

// 查询用户用电记录详细
export function getRecord(id) {
  return request({
    url: '/business/record/' + id,
    method: 'get'
  })
}

// 新增用户用电记录
export function addRecord(data) {
  return request({
    url: '/business/record',
    method: 'post',
    data: data
  })
}

// 修改用户用电记录
export function updateRecord(data) {
  return request({
    url: '/business/record',
    method: 'put',
    data: data
  })
}

// 删除用户用电记录
export function delRecord(id) {
  return request({
    url: '/business/record/' + id,
    method: 'delete'
  })
}

// // 设置用户用电记录为待处理状态
// export function pendingRecord(id) {
//   return request({
//     url: '/business/record/' + id + '/pending',
//     method: 'put'
//   })
// }

// // 设置用户用电记录为继续状态
// export function continueRecord(id) {
//   return request({
//     url: '/business/record/' + id + '/continue',
//     method: 'put'
//   })
// }

// 设置用户用电记录为完成状态
export function finishRecord(id) {
  return request({
    url: '/business/record/' + id + '/finish',
    method: 'put'
  })
}

// 导出用户用电记录
export function exportRecord(query) {
  return request({
    url: '/business/record/export',
    method: 'post',
    data: query
  })
}

// 根据订单编号查询用户用电记录
export function getByOrderId(orderId) {
  return request({
    url: '/business/record/getByOrderId/' + orderId,
    method: 'get'
  })
}

// 根据用户ID查询用户用电记录
export function getInUsing() {
  return request({
    url: '/business/record/getInUsing/',
    method: 'get'
  })
}
